/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax.display.gui;

/**
 *
 * @author Pieman
 */
public class DelayThread extends Thread {
    private int delay;
    private Runnable run;
    boolean alive;

    public DelayThread(int delay, Runnable run) {
        this.delay = delay;
        this.run = run;
        this.alive = true;
    }
    
    public void kill() {
        this.alive = false;
    }

    @Override
    public void run() {
        try {
            long c = 0;
            
            while (c < delay) {
                Thread.sleep(100);
                c += 100;
            }
            if (alive) {
                run.run();
            }
        } catch (InterruptedException ex) {
            
        }
    }
    
    
    
}
